package com.sh.序列化;

import java.io.*;

// 1️⃣ 必须实现 Serializable 接口
public class Person implements Serializable {
    private static final long serialVersionUID = 1L; // 推荐加版本号
    String name;
    int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String toString() {
        return name + " - " + age;
    }
}